package com.mt.api.constants.enums;

import com.mt.api.util.EnumMappingUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Map;

/**
 * @Author: plover
 * @Date: 2021/01/25/10:27
 * @Description:
 */
@Getter
@AllArgsConstructor
public enum ProductStatusEnum {
    NORMAL(1, "正常"),
    CANCEL(9, "撤销"),
    ;


    private Integer code;
    private String name;

    private static final Map<Integer, ProductStatusEnum> statusEnumMap =
            EnumMappingUtil.toMappingMap(ProductStatusEnum.class, ProductStatusEnum::getCode);

    public static ProductStatusEnum ofCode(Integer code) {
        return statusEnumMap.get(code);
    }

}
